Change in openvpn[master]: Remove unused methods write_key/read_key
A message that is not in the archive (sent off-list or not yet received): gerrit.1729216832000.Ib480e57b62ea33f2aea52bee895badaf5607b72d@...2715...
Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/784?usp=email
to review the following change.
Change subject: Remove unused methods write_key/read_key
......................................................................
Remove unused methods write_key/read_key
These were used in the key-method 1 that we remove by commit 36bef1b52 in 2020. That commit unfortunately missed that these methods were only used for directly sending/receiving key material over the control channel.
---
M src/openvpn/crypto.c
M src/openvpn/crypto.h
2 files changed, 0 insertions(+), 86 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/84/784/1
src/openvpn/crypto.c +0 -81
@@ -1540,87 +1540,6 @@ } } -/* given a key and key_type, write key to buffer */ -bool -write_key (const struct key *key,const struct key_type *kt, -struct buffer *buf) -{ -ASSERT (cipher_kt_key_size (kt->cipher) <=MAX_CIPHER_KEY_LENGTH - &&md_kt_size (kt->digest) <=MAX_HMAC_KEY_LENGTH ); - -const uint8_t cipher_length = (uint8_t )cipher_kt_key_size (kt->cipher); -if (!buf_write (buf, &cipher_length,1 )) - { -return false; - } - -uint8_t hmac_length = (uint8_t )md_kt_size (kt->digest); - -if (!buf_write (buf, &hmac_length,1 )) - { -return false; - } -if (!buf_write (buf, key->cipher,cipher_kt_key_size (kt->cipher))) - { -return false; - } -if (!buf_write (buf, key->hmac, hmac_length)) - { -return false; - } - -return true; -} - -/* -* Given a key_type and buffer, read key from buffer. -* Return: 1 on success -* -1 read failure -* 0 on key length mismatch -*/ -int -read_key (struct key *key,const struct key_type *kt,struct buffer *buf) -{ -uint8_t cipher_length; -uint8_t hmac_length; - -CLEAR (*key); -if (!buf_read (buf, &cipher_length,1 )) - { - goto read_err; - } -if (!buf_read (buf, &hmac_length,1 )) - { - goto read_err; - } - -if (cipher_length !=cipher_kt_key_size (kt->cipher) || hmac_length !=md_kt_size (kt->digest)) - { - goto key_len_err; - } - -if (!buf_read (buf, key->cipher, cipher_length)) - { - goto read_err; - } -if (!buf_read (buf, key->hmac, hmac_length)) - { - goto read_err; - } - -return 1 ; - -read_err: -msg (D_TLS_ERRORS ,"TLS Error: error reading key from remote" ); -return -1 ; - -key_len_err: -msg (D_TLS_ERRORS , -"TLS Error: key length mismatch, local cipher/hmac %d/%d, remote cipher/hmac %d/%d" , -cipher_kt_key_size (kt->cipher),md_kt_size (kt->digest), cipher_length, hmac_length); -return 0 ; -} -void prng_bytes (uint8_t *output,int len) {
src/openvpn/crypto.h +0 -5
@@ -313,11 +313,6 @@bool check_key (struct key *key,const struct key_type *kt); -bool write_key (const struct key *key,const struct key_type *kt, -struct buffer *buf); - -int read_key (struct key *key,const struct key_type *kt,struct buffer *buf); -/** * Initialize a key_type structure with. *
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/784?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib480e57b62ea33f2aea52bee895badaf5607b72d
Gerrit-Change-Number: 784
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: flichtenheld, plaisthos.
cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/784?usp=email )
Change subject: Remove unused methods write_key/read_key
......................................................................
Patch Set 1: Code-Review+2
(1 comment)
Patchset:
PS1:
easy enough
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/784?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib480e57b62ea33f2aea52bee895badaf5607b72d
Gerrit-Change-Number: 784
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Fri, 18 Oct 2024 06:31:06 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
PATCH 1/1 Remove unused methods write_key/read_key
In reply to a message not in the archiveFrom: Arne Schwabe <[email protected]...>
These were used in the key-method 1 that we remove by commit 36bef1b52 in 2020. That commit unfortunately missed that these methods were only used for directly sending/receiving key material over the control channel.
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/784
This mail reflects revision 1 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
src/openvpn/crypto.c +0 -81
@@ -1540,87 +1540,6 @@ } } -/* given a key and key_type, write key to buffer */ -bool -write_key (const struct key *key,const struct key_type *kt, -struct buffer *buf) -{ -ASSERT (cipher_kt_key_size (kt->cipher) <=MAX_CIPHER_KEY_LENGTH - &&md_kt_size (kt->digest) <=MAX_HMAC_KEY_LENGTH ); - -const uint8_t cipher_length = (uint8_t )cipher_kt_key_size (kt->cipher); -if (!buf_write (buf, &cipher_length,1 )) - { -return false; - } - -uint8_t hmac_length = (uint8_t )md_kt_size (kt->digest); - -if (!buf_write (buf, &hmac_length,1 )) - { -return false; - } -if (!buf_write (buf, key->cipher,cipher_kt_key_size (kt->cipher))) - { -return false; - } -if (!buf_write (buf, key->hmac, hmac_length)) - { -return false; - } - -return true; -} - -/* -* Given a key_type and buffer, read key from buffer. -* Return: 1 on success -* -1 read failure -* 0 on key length mismatch -*/ -int -read_key (struct key *key,const struct key_type *kt,struct buffer *buf) -{ -uint8_t cipher_length; -uint8_t hmac_length; - -CLEAR (*key); -if (!buf_read (buf, &cipher_length,1 )) - { - goto read_err; - } -if (!buf_read (buf, &hmac_length,1 )) - { - goto read_err; - } - -if (cipher_length !=cipher_kt_key_size (kt->cipher) || hmac_length !=md_kt_size (kt->digest)) - { - goto key_len_err; - } - -if (!buf_read (buf, key->cipher, cipher_length)) - { - goto read_err; - } -if (!buf_read (buf, key->hmac, hmac_length)) - { - goto read_err; - } - -return 1 ; - -read_err: -msg (D_TLS_ERRORS ,"TLS Error: error reading key from remote" ); -return -1 ; - -key_len_err: -msg (D_TLS_ERRORS , -"TLS Error: key length mismatch, local cipher/hmac %d/%d, remote cipher/hmac %d/%d" , -cipher_kt_key_size (kt->cipher),md_kt_size (kt->digest), cipher_length, hmac_length); -return 0 ; -} -void prng_bytes (uint8_t *output,int len) {
src/openvpn/crypto.h +0 -5
@@ -313,11 +313,6 @@bool check_key (struct key *key,const struct key_type *kt); -bool write_key (const struct key *key,const struct key_type *kt, -struct buffer *buf); - -int read_key (struct key *key,const struct key_type *kt,struct buffer *buf); -/** * Initialize a key_type structure with. *
[Openvpn-devel] [PATCH applied] Re: Remove unused methods write_key/read_key
This one is quite straightforward... only sanity-checked (after staring at the code ;-) ) via a local build.
Your patch has been applied to the master branch.
commit 8ae409ad72a980d79dd8d40ab4284c3fab1efeb9
Author: Arne Schwabe Date: Fri Oct 18 08:31:23 2024 +0200
Remove unused methods write_key/read_key
Signed-off-by: Arne Schwabe <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg29595.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#2) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/784?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by cron2
Change subject: Remove unused methods write_key/read_key
......................................................................
Remove unused methods write_key/read_key
These were used in the key-method 1 that we remove by commit 36bef1b52 in 2020. That commit unfortunately missed that these methods were only used for directly sending/receiving key material over the control channel.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg29595.html
---
M src/openvpn/crypto.c
M src/openvpn/crypto.h
2 files changed, 0 insertions(+), 86 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/84/784/2
src/openvpn/crypto.c +0 -81
@@ -1540,87 +1540,6 @@ } } -/* given a key and key_type, write key to buffer */ -bool -write_key (const struct key *key,const struct key_type *kt, -struct buffer *buf) -{ -ASSERT (cipher_kt_key_size (kt->cipher) <=MAX_CIPHER_KEY_LENGTH - &&md_kt_size (kt->digest) <=MAX_HMAC_KEY_LENGTH ); - -const uint8_t cipher_length = (uint8_t )cipher_kt_key_size (kt->cipher); -if (!buf_write (buf, &cipher_length,1 )) - { -return false; - } - -uint8_t hmac_length = (uint8_t )md_kt_size (kt->digest); - -if (!buf_write (buf, &hmac_length,1 )) - { -return false; - } -if (!buf_write (buf, key->cipher,cipher_kt_key_size (kt->cipher))) - { -return false; - } -if (!buf_write (buf, key->hmac, hmac_length)) - { -return false; - } - -return true; -} - -/* -* Given a key_type and buffer, read key from buffer. -* Return: 1 on success -* -1 read failure -* 0 on key length mismatch -*/ -int -read_key (struct key *key,const struct key_type *kt,struct buffer *buf) -{ -uint8_t cipher_length; -uint8_t hmac_length; - -CLEAR (*key); -if (!buf_read (buf, &cipher_length,1 )) - { - goto read_err; - } -if (!buf_read (buf, &hmac_length,1 )) - { - goto read_err; - } - -if (cipher_length !=cipher_kt_key_size (kt->cipher) || hmac_length !=md_kt_size (kt->digest)) - { - goto key_len_err; - } - -if (!buf_read (buf, key->cipher, cipher_length)) - { - goto read_err; - } -if (!buf_read (buf, key->hmac, hmac_length)) - { - goto read_err; - } - -return 1 ; - -read_err: -msg (D_TLS_ERRORS ,"TLS Error: error reading key from remote" ); -return -1 ; - -key_len_err: -msg (D_TLS_ERRORS , -"TLS Error: key length mismatch, local cipher/hmac %d/%d, remote cipher/hmac %d/%d" , -cipher_kt_key_size (kt->cipher),md_kt_size (kt->digest), cipher_length, hmac_length); -return 0 ; -} -void prng_bytes (uint8_t *output,int len) {
src/openvpn/crypto.h +0 -5
@@ -313,11 +313,6 @@bool check_key (struct key *key,const struct key_type *kt); -bool write_key (const struct key *key,const struct key_type *kt, -struct buffer *buf); - -int read_key (struct key *key,const struct key_type *kt,struct buffer *buf); -/** * Initialize a key_type structure with. *
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/784?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib480e57b62ea33f2aea52bee895badaf5607b72d
Gerrit-Change-Number: 784
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/784?usp=email )
Change subject: Remove unused methods write_key/read_key
......................................................................
Remove unused methods write_key/read_key
These were used in the key-method 1 that we remove by commit 36bef1b52 in 2020. That commit unfortunately missed that these methods were only used for directly sending/receiving key material over the control channel.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg29595.html
---
M src/openvpn/crypto.c
M src/openvpn/crypto.h
2 files changed, 0 insertions(+), 86 deletions(-)
src/openvpn/crypto.c +0 -81
@@ -1540,87 +1540,6 @@ } } -/* given a key and key_type, write key to buffer */ -bool -write_key (const struct key *key,const struct key_type *kt, -struct buffer *buf) -{ -ASSERT (cipher_kt_key_size (kt->cipher) <=MAX_CIPHER_KEY_LENGTH - &&md_kt_size (kt->digest) <=MAX_HMAC_KEY_LENGTH ); - -const uint8_t cipher_length = (uint8_t )cipher_kt_key_size (kt->cipher); -if (!buf_write (buf, &cipher_length,1 )) - { -return false; - } - -uint8_t hmac_length = (uint8_t )md_kt_size (kt->digest); - -if (!buf_write (buf, &hmac_length,1 )) - { -return false; - } -if (!buf_write (buf, key->cipher,cipher_kt_key_size (kt->cipher))) - { -return false; - } -if (!buf_write (buf, key->hmac, hmac_length)) - { -return false; - } - -return true; -} - -/* -* Given a key_type and buffer, read key from buffer. -* Return: 1 on success -* -1 read failure -* 0 on key length mismatch -*/ -int -read_key (struct key *key,const struct key_type *kt,struct buffer *buf) -{ -uint8_t cipher_length; -uint8_t hmac_length; - -CLEAR (*key); -if (!buf_read (buf, &cipher_length,1 )) - { - goto read_err; - } -if (!buf_read (buf, &hmac_length,1 )) - { - goto read_err; - } - -if (cipher_length !=cipher_kt_key_size (kt->cipher) || hmac_length !=md_kt_size (kt->digest)) - { - goto key_len_err; - } - -if (!buf_read (buf, key->cipher, cipher_length)) - { - goto read_err; - } -if (!buf_read (buf, key->hmac, hmac_length)) - { - goto read_err; - } - -return 1 ; - -read_err: -msg (D_TLS_ERRORS ,"TLS Error: error reading key from remote" ); -return -1 ; - -key_len_err: -msg (D_TLS_ERRORS , -"TLS Error: key length mismatch, local cipher/hmac %d/%d, remote cipher/hmac %d/%d" , -cipher_kt_key_size (kt->cipher),md_kt_size (kt->digest), cipher_length, hmac_length); -return 0 ; -} -void prng_bytes (uint8_t *output,int len) {
src/openvpn/crypto.h +0 -5
@@ -313,11 +313,6 @@bool check_key (struct key *key,const struct key_type *kt); -bool write_key (const struct key *key,const struct key_type *kt, -struct buffer *buf); - -int read_key (struct key *key,const struct key_type *kt,struct buffer *buf); -/** * Initialize a key_type structure with. *
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/784?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib480e57b62ea33f2aea52bee895badaf5607b72d
Gerrit-Change-Number: 784
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged